﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Utilities
{
    public class TaskConfiguration
    {
        public string Type { get; set; }

        public string Id { get; set; }

        public dynamic Data { get; set; }
    }

    public static class TaskFactory
    {
        private static readonly IDictionary<string, Type> _registry = new Dictionary<string, Type>();

        public static TaskBase Create(TaskConfiguration config)
        {
            Type type = _registry[config.Type];
            TaskBase task = type.CreateInstance<TaskBase>();
            task.Id = config.Id;

            return task;
        }
    }
}
